#!/usr/bin/env python
#coding: utf-8
'''
Created on 2017年4月17日

@author: Administrator
'''


from django.contrib import admin
from message.models import Message, EmailMessage, MobileMessage, ValidateMessage

class MessageAdmin(admin.ModelAdmin):
    list_display = ('send_user', 'recv_user', 'content', 'create_time', 'readed', 'category')
    list_filter = ('readed', 'category')
    raw_id_fields = ('send_user', 'recv_user')
    search_fields = ('send_user__email', 'recv_user__email')
    list_per_page = 10

admin.site.register(Message, MessageAdmin)


class EmailMessageAdmin(admin.ModelAdmin):
    list_display = ('email', 'recv_user', 'subject', 'content', 'create_time', 'is_pushed')
    list_filter = ('is_pushed',)
    raw_id_fields = ('recv_user',)
    search_fields = ('email',)

admin.site.register(EmailMessage, EmailMessageAdmin)

class MobileMessageAdmin(admin.ModelAdmin):
    list_display = ('recv_user', 'mobile', 'content', 'create_time', 'is_pushed')
    list_filter = ('is_pushed',)
    raw_id_fields = ('recv_user',)
    search_fields = ('mobile',)

admin.site.register(MobileMessage, MobileMessageAdmin)

class ValidateMessageAdmin(admin.ModelAdmin):
    list_display = ('category', 'sendto', 'validatecode', 'is_pushed', 'ip', 'create_time', 'useat')
    list_filter = ('is_pushed', 'category')
    # raw_id_fields = ('recv_user',)
    search_fields = ('sendto',)

admin.site.register(ValidateMessage, ValidateMessageAdmin)
